{layout name="public:layout" /}

<h4 class="text-center text-success">用户列表</h4>
<table class="table table-default table-hover text-center">
    <tr>
        <td>ID</td>
        <td>用户名</td>
        <td>邮箱</td>
        <td>手机号</td>
        <td>注册时间</td>
        <td>状态</td>
        <td>身份</td>
        <td colspan="2">操作</td>
    </tr>

    {volist name="userList" id="user" empty="$empty"}
    <tr>
        <td>{$user.id}</td>
        <td>{$user.name}</td>
        <td>{$user.email}</td>
        <td>{$user.mobile}</td>
        <td>{$user.create_time|date='Y-m-d'}</td>

        <td>
            {eq name="$user.status" value="1"}
            <span style="color: green">开启</span>
            {else/}
            <span style="color: red">禁用</span>
            {/eq}
        </td>

        <td>
            {eq name="$user.is_admin" value="0"}
            <span style="color: #1e88e5">注册会员</span>
            {else/}
            <span style="color: green">超级管理员</span>
            {/eq}
        </td>


<!--       非当前用户不允许编辑其他用户信息 -->
        {eq name="$user.id" value="$Think.session.admin_id"}
        <td><a href="{:url('user/userEdit',['id'=>$user.id])}">编辑</a> </td>
        {/eq}

        {neq name="$user.id" value="$Think.session.admin_id"}
        <td><a href="{:url('admin/user/doDelete',['id'=>$user.id])}" onclick="dele(event)">删除</a></td>
        {/neq}
    </tr>
    {/volist}
</table>

<script>
    function dele(event) {
        if (confirm('确定删除吗')==true){
        }else {
            //阻止a连接生效
            event.preventDefault();
        }
    }

</script>